<?php

namespace app\api\model;

class UserMoneyLogModel extends BaseModel
{
    protected $pk = 'id';
    protected $table = 'hs_user_money_log';
    protected static $tableName = 'user_money_log';

    public function getCreateTimeAttr($value)
    {
        return date('Y-m-d H:i:s', $value);
    }

    public static function lst($params)
    {
        $page = isset($params['page']) ? $params['page'] : 1;
        $limit = isset($params['limit']) ? $params['limit'] : 5;
        $list = self::where('user_id', $params['user_id'])
            ->field('id,money,before,after,memo,createtime')
            ->page((int)$page, (int)$limit)->order('id desc')
            ->select();
        return $list;
    }
}